// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'

Vue.config.productionTip = false
router.beforeEach((to,from,next)=>{
  console.log(to)
  console.log(from)
  let Account=to.query.Account
  let psd=to.query.psd
  if(from.path=='/login'&&Account!='admin'){
    alert('用户名错误，请从新输入')
    next('/login')
  }else if(from.path=='/login'&&psd!='123456'){
    alert('密码错误，请从新输入')
    next('/login')
  }else{
    next()
  }
})
router.beforeResolve((to,from,next)=>{
  console.log('beforeResolve')
  next()
})
router.afterEach((to,from)=> {
  console.log('afterEach')
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
